Skip to content

fix(server): archiving a parent no longer kills a child's pending check-back - #1056

Merged
badcuban merged 3 commits into
mainfrom
fix/archive-keeps-child-check-backs
Nov 23, 2026
Merged

badcuban merged 3 commits into
mainfrom
fix/archive-keeps-child-check-backs

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

A child thread that answered its parent, set a check-back that lives only in its Claude session, and went idle counted as settled. Archiving the parent (by hand or through auto-archive) archived the child with it and stopped its session, so the check-back died. Unarchiving brought the thread back but not the check-back, and the work the agent promised was lost without a word. Auto-archive and Settings' "Archive inactive threads now" had the same hole for any thread, child or not.

Fix

  • Archive cascade. childArchivePlan separates a child holding any check-back that isn't saved to disk (holdsRuntimeCheckBack), so its session keeps running. The rule reads no clock, so the decider stays deterministic; a stale entry only leaves a child as its own thread.
  • Auto-archive and "Archive inactive threads now". isAutoArchiveProtectedThread skips a thread whose check-back is still owed, by the idle reaper's own rule (runtimeCheckBackOwed, moved to @threadlines/shared/checkBacks): a one-off until a little past its time, a repeating one until Claude would have dropped it. These paths read the clock, so an entry whose runtime ended without its report landing stops protecting the thread on its own. The sweeper also skips a parent whose child holds one.
  • Re-checked at dispatch. The sweeper rereads each candidate right before archiving it, and the Settings button re-checks each thread against the live store, so a thread that started working or set a check-back since the list was made is left alone.

childHasLiveWork is unchanged. Its other callers (wrap rules, thread_wrap, stop targets, checkout moves, push alerts, late replies) mean "working right now", and the Nov 9 snooze decision says a check-back doesn't keep a thread out of Wrapped. The idle reaper's behavior is unchanged; it now reads its rule from the shared module.

Known limits

  • A child on a linked computer that the parent still has a request open for is stopped there when the parent is archived, stopped or wrapped (peer.thread.stop), and that stop ends its session-only check-backs. Interrupting only its turn would leave background work running there that nothing on this computer shows.
  • A check-back set in the moment between a bulk archive's re-check and its dispatch can still be cut off. A child that sets one after the sweeper's snapshot is separated by the cascade, not archived.
  • Archiving a thread by name still ends its own session-only check-backs, as before: that is the user's call.

Tests

  • decider.childThreads.test.ts: archiving a parent separates a child with a session-only check-back and archives one with a saved check-back.
  • ThreadAutoArchiveSweeper.test.ts: the sweeper neither archives nor stops a child holding a check-back and skips its parent; a two-day-old stale entry no longer protects; a thread that set a check-back after the snapshot isn't archived.
  • threadAutoArchive.test.ts (shared): a thread with an owed check-back is no candidate; a saved one, a stale one-off and a stale repeating one don't protect it.
  • Each new case fails with its fix taken out.

…ck-back

A child thread that answered its parent and set a check-back (one that
lives only in its Claude session) counted as settled, so archiving the
parent archived the child too and stopped its session. The check-back
died with it, and unarchiving brought back the thread but not the
check-back.

The rule the idle reaper uses to keep such a runtime now lives in
@threadlines/shared/checkBacks (runtimeCheckBackOwed,
holdsRuntimeCheckBack). The archive cascade (childArchivePlan) separates
a child that holds one instead of archiving it, and the auto-archive
sweeper leaves its parent alone, as it does a parent with a working
child. Durable check-backs and ones long past their time don't count.
childHasLiveWork is unchanged: its other callers (wrap, thread_wrap,
stop targets, moves, alerts, late replies) mean "working now", and a
check-back doesn't keep a thread out of Wrapped.
… no clock

Review follow-ups to the archive cascade fix:

- Auto-archive and "Archive inactive threads now" could still archive the
  child (or any thread) holding the check-back directly. The rule now
  lives in isAutoArchiveProtectedThread, which both paths use.
- The cascade read the decider's clock to judge a check-back's grace
  window, so one command could decide differently around a boundary.
  holdsRuntimeCheckBack is now time-free: any check-back not saved to
  outlive the runtime counts. The idle reaper is back to its own rule.
- So a stale entry can't block auto-archive for good, thread.archive
  clears the runtime-only check-backs of every thread it archives, with
  a "Check-back ended" note. The runtime's report of them comes after
  the archive and was never recorded for an archived thread.
- A linked child stopped for an archived parent's open request still
  loses its check-backs; documented as a known limit.
…earing

Second review round on the archive cascade fix:

- Drop the check-back clearing inside thread.archive. It could report a
  check-back ended while a room agent's runtime still held it (the named
  archive stops only the projected session), and two agents with the same
  schedule id shared one note id.
- The cascade keeps its time-free rule (holdsRuntimeCheckBack): a stale
  entry only leaves a child as its own thread.
- Auto-archive and "Archive inactive threads now" use the idle reaper's
  time-windowed rule (runtimeCheckBackOwed, now in shared/checkBacks), so
  an entry whose runtime ended unreported, or one from before this fix,
  stops protecting a thread on its own. The reaper's behavior is unchanged.
- The sweeper rereads each candidate before archiving it, and the Settings
  button re-checks each thread against the live store, so one that set a
  check-back since the list was made is left alone.
@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 23, 2026 4:24pm UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 8362605 Nov 23, 2026
23 checks passed
@badcuban
badcuban deleted the fix/archive-keeps-child-check-backs branch November 23, 2026 16:39

This branch was previously deployed

1 inactive deployment
Preview — 7aff5904 Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant